//
//  ViewController.swift
//  lovelyWeather
//
//  Created by MAC on 2019/7/27.
//  Copyright © 2019 zk. All rights reserved.
//

import UIKit


class WeatherDetailViewController: UIViewController,UIScrollViewDelegate {
    
    var weather:weatherModel?
    override func viewDidLoad() {
        super.viewDidLoad()

        self.navigationController?.navigationBar.isTranslucent = true
        

        self.fd_prefersNavigationBarHidden = true
 

        self.view.backgroundColor = color1
       
        let cardView = PileListView(frame: CGRect(x: 0, y: NavBarHeight, width: kScreenW, height: 550))
        let data = [weather!.hours[0],weather!.hours[1],weather!.hours[3],weather!.hours[4]]
        cardView.configData(data)
        cardView.delegate = self
        self.view.addSubview(cardView)
        
        
        let back = UIButton(type: UIButton.ButtonType.custom)
        back.frame = CGRect(x: 15,y: StatusBarHeight ,width: 44,height: 44)
        back.setImage(UIImage.init(named: "back"), for: UIControl.State.normal)
        back.contentHorizontalAlignment = UIControl.ContentHorizontalAlignment.left
        back.addTarget(self, action: #selector(backAct), for: UIControl.Event.touchUpInside)
        self.view.addSubview(back)
        
    }
    
    @objc func backAct() {
        self.navigationController?.popViewController(animated: true)
    }
    
    func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
        targetContentOffset.pointee = scrollView.contentOffset
        
    }
}

